{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 构建一个离散的dist-DQN# \n",
    "#构建一个离散的概率分布\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [],
   "source": [
    "import torch\n",
    "import numpy as np\n",
    "from matplotlib import pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x7fd6f1366a90>]"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAkYAAAGdCAYAAAD3zLwdAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAA9hAAAPYQGoP6dpAAA6lElEQVR4nO3df3RU9Z3/8deEMIkQJ4EkJATDDxUCpQgIZgiNxm5zEpWKsa1oSk2WjUK7aNFov4E9x0bdsw0KqXaRilQJ7tqzQLbUItBiSFAKhF9JUEGkwgKC+bUQM8FQSMh8vn94udsxE8ik8iPx+TjnntP5fN6fz/3cucb76p07o8MYYwQAAAAFXekFAAAAXC0IRgAAABaCEQAAgIVgBAAAYCEYAQAAWAhGAAAAFoIRAACAhWAEAABgCb7SC+huvF6vqqurde2118rhcFzp5QAAgE4wxujUqVOKi4tTUFDH94UIRgGqrq5WfHz8lV4GAADogmPHjum6667rsJ9gFKBrr71W0hdvrMvlusKrAQAAndHU1KT4+Hj7Ot4RglGAzn985nK5CEYAAHQzF3sMhoevAQAALAQjAAAAC8EIAADAQjACAACwEIwAAAAsBCMAAAALwQgAAMBCMAIAALAQjAAAACwEIwAAAAvBCAAAwEIwAgAAsBCMAAAALAQjAAAAC8EIAADAQjACAACwEIwAAAAsBCMAAAALwQgAAMB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louOO5qP4eLFy/W0KFDFRoaKrfbrZ07d16wvri4WCNHjlRoaKjGjBmj9evXX6aVBqagoEC33HKLrr32Wg0YMEAZGRk6cODABccsX7683bkKDQ29TCsO3NNPP91uvSNHjrzgmO5y/iT//z5xOByaPXu23/qr/fxt3rxZd999t+Li4uRwOPTmm2/69Btj9POf/1wDBw7UNddco9TUVH388ccXnTfQv+FAEYwuo5aWFt133336yU9+4re/ra1NU6ZMUUtLi7Zt26bXX39dy5cv189//vMLzjt9+nTt27dPJSUlWrt2rTZv3qyZM2deikPotMmTJ6umpsZne+ihhzRs2DBNnDjxgmMffvhhn3HPP//8ZVp11zz77LM+63300UcvWP/444/rrbfeUnFxsd59911VV1fre9/73mVabed99NFH8nq9euWVV7Rv3z698MILWrJkif7lX/7lomOv1nO4cuVK5ebmKj8/X5WVlRo7dqzS09NVX1/vt37btm3KzMxUTk6OqqqqlJGRoYyMDO3du/cyr/zi3n33Xc2ePVvbt29XSUmJWltblZaWpubm5guOc7lcPufq6NGjl2nFXTN69Gif9W7ZsqXD2u50/iRp165dPsdWUlIiSbrvvvs6HHM1n7/m5maNHTtWixcv9tv//PPP69///d+1ZMkS7dixQ3379lV6errOnDnT4ZyB/g13icFlV1RUZMLDw9u1r1+/3gQFBZna2lq77eWXXzYul8ucPXvW71wffvihkWR27dplt/3xj380DofDfPrpp1/52ruqpaXFREdHm2efffaCdSkpKWbOnDmXZ1FfgSFDhpgXXnih0/WNjY2md+/epri42G7bv3+/kWTKy8svwQq/Ws8//7wZNmzYBWuu5nOYmJhoZs+ebb9ua2szcXFxpqCgwG/9tGnTzJQpU3za3G63mTVr1iVd51ehvr7eSDLvvvtuhzUd/bvoapWfn2/Gjh3b6frufP6MMWbOnDnmhhtuMF6v129/dzp/kszvf/97+7XX6zWxsbFmwYIFdltjY6MJCQkx//Vf/9XhPIH+DXcFd4yuIuXl5RozZoxiYmLstvT0dDU1NWnfvn0djomIiPC5C5OamqqgoCDt2LHjkq+5s9asWaOTJ09qxowZF6397W9/q6ioKH3zm9/UvHnzdPr06cuwwq6bP3++IiMjNX78eC1YsOCCH31WVFSotbVVqampdtvIkSM1ePBglZeXX47l/l08Ho/69+9/0bqr8Ry2tLSooqLC570PCgpSampqh+99eXm5T730xd9kdzlXki56vj7//HMNGTJE8fHxuueeezr8d83V4uOPP1ZcXJyuv/56TZ8+XZ988kmHtd35/LW0tOiNN97QP/3TP13wP1je3c7feYcPH1Ztba3P+QkPD5fb7e7w/HTlb7gr+I/IXkVqa2t9QpEk+3VtbW2HYwYMGODTFhwcrP79+3c45kp47bXXlJ6eftH/AO8Pf/hDDRkyRHFxcXr//feVl5enAwcOaPXq1ZdppYH56U9/qptvvln9+/fXtm3bNG/ePNXU1OiXv/yl3/ra2lo5nc52z5jFxMRcVefLn4MHD2rRokVauHDhBeuu1nN44sQJtbW1+f0b++ijj/yO6ehv8mo/V16vV4899pi+9a1v6Zvf/GaHdQkJCVq2bJluuukmeTweLVy4UJMnT9a+ffsu6X8su6vcbreWL1+uhIQE1dTU6JlnntGtt96qvXv36tprr21X313PnyS9+eabamxs1D/+4z92WNPdzt/fOn8OAjk/Xfkb7gqC0d9p7ty5eu655y5Ys3///os+INhddOV4jx8/rg0bNmjVqlUXnf9vn40aM2aMBg4cqO985zs6dOiQbrjhhq4vPACBHGNubq7ddtNNN8npdGrWrFkqKCi4an+yvyvn8NNPP9Udd9yh++67Tw8//PAFx14N5/Drbvbs2dq7d+8Fn7+RpKSkJCUlJdmvJ0+erFGjRumVV17Rv/7rv17qZQbszjvvtP/3TTfdJLfbrSFDhmjVqlXKycm5giv76r322mu68847FRcX12FNdzt/3QXB6O/0xBNPXDDRS9L111/fqbliY2PbPV1//ttKsbGxHY758kNn586dU0NDQ4dj/h5dOd6ioiJFRkZq6tSpAe/P7XZL+uJuxeW6qP4959TtduvcuXM6cuSIEhIS2vXHxsaqpaVFjY2NPneN6urqLsn58ifQ46uurta3v/1tTZ48WUuXLg14f1fiHPoTFRWlXr16tfsG4IXe+9jY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I0fMnXfeaa655hoTFRVlnnjiCZ//17Bp0yYjyRw+fNhuO3nypMnMzDRhYWHG5XKZGTNm2GHrSsvMzDSTJ0/223f48GGf4//kk0/MbbfdZvr3729CQkLMjTfeaH72s58Zj8dzGVfceRUVFcbtdpvw8HATGhpqRo0aZX7xi1/43N378jEaY8xf//pX88///M+mX79+pk+fPubee+/1CRtXi6KiIr//vP7tjebueA4XLVpkBg8ebJxOp0lMTDTbt2+3+1JSUkx2drZP/apVq8yIESOM0+k0o0ePNuvWrbvMK+6cjs5VUVGRXfPl43vsscfs9yImJsbcddddprKy8vIvvpPuv/9+M3DgQON0Os2gQYPM/fffbw4ePGj3d+fzd96GDRuMJHPgwIF2fd3t/J2/Xn15O38MXq/XPPXUUyYmJsaEhISY73znO+2Oe8iQISY/P9+n7UJ/w18FhzHGfHUfzAEAAHRf/I4RAACAhWAEAABgIRgBAABYCEYAAAAWghEAAICFYAQAAGAhGAEAAFgIRgAAABaCEQAAgIVgBAAAYCEYAQAAWAhGAAAAlv8PS1tmDdMqFNQAAAAASUVORK5CYII=",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "vmin,vmax = -10,10\n",
    "nsub = 51\n",
    "support  = np.linspace(vmin,vmax,nsub) #建立分隔\n",
    "probs = np.ones(nsub)# 返回一个均匀分布\n",
    "probs /= probs.sum()   \n",
    "z3 = torch.from_numpy(probs).float()\n",
    "plt.plot(support,probs) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [],
   "source": [
    "def update_dist(r,support,probs,lim=[-10,10], gamma=0.8):\n",
    "    nsub = probs.shape[0]\n",
    "    vmin,vmax = lim[0],lim[1]\n",
    "    dz = (vmax - vmin)/(nsub-1)\n",
    "    bj= np.round((r-vmin)/dz)\n",
    "    bj = int(np.clip(bj,0,nsub-1))\n",
    "    m = probs.clone()\n",
    "    j = 1\n",
    "    for i in range(bj,1,-1):\n",
    "        m[i] += np.power(gamma,j)*m[i-1]\n",
    "        j+=1\n",
    "    j =1\n",
    "    for i in range(bj,nsub-1,1):\n",
    "        m[i]+=np.power(gamma,j)*m[i+1]\n",
    "        j +=1\n",
    "    \n",
    "    m /=m.sum()\n",
    "    return m\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<BarContainer object of 51 artists>"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAjUAAAGdCAYAAADqsoKGAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAA9hAAAPYQGoP6dpAAArkElEQVR4nO3dcUycdZ7H8Q9DD0ZrgQKWgR4Ke6K0ljJaypTGu9p04riS9dirSrm65Rpi3YvFtuPuCg2F1tOD1VS5bjlJL97pJfboNfGIhw0JojnXMEcttNmtsU01VqrtTEuaMjqmUJi5P3odnWWoTG2l/Hy/kifK7/k+v+f7MBnn4/M88xAXCoVCAgAAmOYsU90AAADA1UCoAQAARiDUAAAAIxBqAACAEQg1AADACIQaAABgBEINAAAwAqEGAAAYYcZUN/BDCQaDOnnypGbNmqW4uLipbgcAAExCKBTSl19+qaysLFkslz8X86MJNSdPnlR2dvZUtwEAAK7AiRMn9Od//ueXrfnRhJpZs2ZJuvhLSUpKmuJuAADAZPj9fmVnZ4c/xy/nRxNqLl1ySkpKItQAADDNTObWEW4UBgAARiDUAAAAIxBqAACAEQg1AADACIQaAABgBEINAAAwAqEGAAAYgVADAACMQKgBAABGINQAAAAjEGoAAIARCDUAAMAIhBoAAGAEQg0AADDCjKluAMD0llPz1vee43hT6VXoBMCPHWdqAACAEQg1AADACIQaAABgBEINAAAwAqEGAAAYgVADAACMQKgBAABGINQAA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JycnhJTs7e1LHCAAApqfr6ttPFy5c0COPPKJQKKSXX375e81VW1uroaGh8HLixImr1CUAALgexXT5KT09XfHx8fL5fBHjPp9PNpst6jY2m21S9ZcCzWeffaZ33nkn4rqZzWYbdyPy6Oiozp49O+F+ExMTlZiYOOljAwAA01tMZ2oSEhK0aNEidXd3h8eCwaC6u7tVUlISdZuSkpKIeknq6uqKqL8UaI4dO6a3335baWlp4+Y4d+6c+vr6wmPvvPOOgsGgHA5HLIcAAAAMFdOZGklyu92qrKxUUVGRiouL1dzcrEAgoLVr10qS1qxZo7lz56qxsVGStGHDBi1btkzbt29XaWmp2tradODAAe3atUvSxUDz0EMPqb+/Xx0dHRobGwvfJ5OamqqEhATNmzdP999/vx577DG1trbqwoULWr9+vVatWjWpbz4BAADzxRxqysvLdebMGdXX18vr9cput6uzszN8M/DAwIAslm9OAC1dulS7d+9WXV2dNm/erLy8PLW3t2vBggWSpC+++EJvvvmmJMlut0fs691339W9994rSXr99de1fv16rVixQhaLRStXrtSOHTuu5JiBae/H9s2mq4VvSAFmi/k5NdMVz6mBSQg11w6hBri+xPL5fV19+wkAAOBKxXz5CcC1xVmYqfVdv3/O5ADXL0IN8AMjtExv3JcDXL8INVcJH1QALuG/B/ixmupAzz01AADACIQaAABgBEINAAAwAqEGAAAYgVADAACMQKgBAABGINQAAAAjEGoAAIARCDUAAMAIhBoAAGAEQg0AADACoQYAABiBUAMAAIxAqAEAAEYg1AAAACMQagAAgBEINQAAwAiEGgAAYARCDQAAMAKhBgAAGIFQAwAAjECoAQAARiDUAAAAIxBqAACAEQg1AADACIQaAABgBEINAAAwAqEGAAAYgVADAACMQKgBAABGINQAAAAjXFGoaWlpUU5OjqxWqxwOh/bv33/Z+r179yo/P19Wq1UFBQXat29fxPo33nhD9913n9LS0hQXF6dDhw6Nm+Pee+9VXFxcxPLLX/7yStoHAAAGijnU7NmzR263Ww0NDerv71dhYaFcLpdOnz4dtb6np0cVFRWqqqrSwYMHVVZWprKyMh0+fDhcE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pp57S3/3d31225ic/+cmk5rLZbOO+qeHz+cLrcG18n9fQ4XBodHRUx48f1x133HENusNkpaenKz4+PvyeucTn8/H+mQZSUlJ0++236+OPP57qVjAJl95TPp9PmZmZ4XGfzye73T5FXUUi1FyBm2++WTfffPNVmaukpETPPfecTp8+rTlz5kiSurq6lJSUpPnz51+VfWC87/MaHjp0SBaLJfx6YeokJCRo0aJF6u7uVllZmSQpGAyqu7tb69evn9rm8J2++uorffLJJ/rFL34x1a1gEnJzc2Wz2dTd3R0OMX6/X729vRN+w/eHRqi5xgYGBnT27FkNDAxobGxMhw4dkiTddtttuummm3Tfffdp/vz5+sUvfqHnn39eXq9XdXV1euKJJ677v4b6Y+DxeNTb26vly5dr1qxZ8ng82rRpkx599FHNnj17qtuDLl4erKysVFFRkYqLi9Xc3KxAIKC1a9dOdWv4E7/61a/0s5/9TLfeeqtOnjyphoYGxcfHq6KiYqpbw//76quvIs6cffrppzp06JBSU1N1yy23aOPGjXr22WeVl5en3NxcbdmyRVlZWeH/qZhyU/31K9NVVlaGJI1b3n333XDN8ePHQz/96U9DN9xwQyg9PT301FNPhS5cuDB1TSOsr68v5HA4QsnJySGr1RqaN29e6B//8R9D58+fn+rW8C2/+93vQrfccksoISEhVFxcHPrf//3fqW4JUZSXl4cyMzNDCQkJoblz54bKy8tDH3/88VS3hW959913o35mVVZWhkKhi1/r3rJlSygjIyOUmJgYWrFiRejo0aNT2/S3xIVCodBUBSoAAICrhW8/AQAAIxBqAACAEQg1AADACIQaAABgBEINAAAwAqEGAAAYgVADAACMQKgBAABGINQAAAAjEGoAAIARCDUAAMAIhBoAAGCE/wPhfShGZkdfGAAAAABJRU5ErkJggg==",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "ob_reward = -1\n",
    "z = torch.from_numpy(probs).float()\n",
    "z = update_dist(ob_reward,torch.from_numpy(support).float(),z,gamma=0.5) \n",
    "plt.bar(support,z)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<BarContainer object of 51 artists>"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAiwAAAGdCAYAAAAxCSikAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAA9hAAAPYQGoP6dpAAAe1klEQVR4nO3df2xV9f3H8VdbbIuMXieVXoqFYlap2NrOQi9tnGjWeDVVV5ex2jjoGrLFRRAsMlsC7dx05aurq0Jjwx+b+8VgZLFh0HRjHbqZXmG0EMPiDzRiiXhvIc5Wu9Fi7/n+4bjujgv0lsJ9tzwfyY3p6eccPifXe++z59xzb5zjOI4AAAAMi4/1BAAAAM6HYAEAAOYRLAAAwDyCBQAAmEewAAAA8wgWAABgHsECAADMI1gAAIB5k2I9gbEQDAZ17NgxTZ06VXFxcbGeDgAAGAHHcfTxxx8rPT1d8fHnPoYyIYLl2LFjysjIiPU0AADAKBw9elTXXnvtOcdMiGCZOnWqpM92OCUlJcazAQAAI9Hf36+MjIzQ6/i5TIhgOX0aKCUlhWABAGCcGcnbOXjTLQAAMI9gAQAA5hEsAADAPIIFAACYR7AAAADzCBYAAGAewQIAAMwjWAAAgHkECwAAMI9gAQAA5hEsAADAPIIFAACYR7AAAADzCBYAAGDepFhPAAAulcyaXRe8jSMbSsdgJgCixREWAABgHsECAADMI1gAAIB5BAsAADCPYAEAAOYRLAAAwDyCBQAAmEewAAAA8wgWAABgHsECAADMI1gAAIB5BAsAADCPYAEAAOYRLAAAwDyCBQAAmEewAAAA8wgWAABgHsECAADMI1gAAIB5BAsAADBvVMHS3NyszMxMJScny+PxaN++feccv337dmVnZys5OVm5ublqa2sL+/0nn3yi5cuX69prr9XkyZM1b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Q+h3G3oXcfx6PR59++qmOHDmiuXPnXoTZYaRSU1OVkJAQerycFggEeOyME1dddZWuv/56vf3227GeCs7j9GMqEAhoxowZoeWBQED5+fkxmlU4giWCa665Rtdcc82YbKuoqEhPPvmkent7NX36dEnS7t27lZKSonnz5o3Jv4FwF3L/HTx4UPHx8aH7CrGTmJiogoICdXR0hL65PRgMqqOjQ8uXL4/t5DAin3zyid555x0tWbIk1lPBecyZM0dut1sdHR2hQOnv79fevXvPehXspUawXKCenh59+OGH6unp0fDwsA4ePChJ+tKXvqQvfOELuuOOOzRv3jwtWbJETz31lPx+v9atW6eHHnrI/DdjTnQ+n0979+7V7bffrqlTp8rn8+mRRx7Rt771LX3xi1+M9fSgz07ZVVZWav78+SosLFRTU5MGBgZUVVUV66khgkcffVT33HOPZs+erWPHjqm+vl4JCQmqqKiI9dSgzwLyv492vfvuuzp48KCuvvpqzZo1S6tWrdITTzyhrKwszZkzR+vXr1d6enroD4aYi/VlSuNdZWWlI+mM2549e0Jjjhw54tx1113O5MmTndTUVGf16tXOqVOnYjdpOI7jOF1dXY7H43FcLpeTnJzs3HDDDc6Pf/xj5+TJk7GeGv7Lxo0bnVmzZjmJiYlOYWGh8+qrr8Z6SjiL8vJyZ8aMGU5iYqIzc+ZMp7y83Hn77bdjPS38x549eyK+XlVWVjqO89mlzevXr3fS0tKcpKQk56tf/arz5ptvxnbS/yXOcRwnVrEEAAAwElwlBAAAzCNYAACAeQQLAAAwj2ABAADmESwAAMA8ggUAAJhHsAAAAPMIFgAAYB7BAgAAzCNYAACAeQQLAAAwj2ABAADm/T8wPZJSTA6PRAAAAABJRU5ErkJggg==",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "ob_reward = [-10,10,10,10,0,1,2,1,1]\n",
    "for ob in ob_reward:\n",
    "    z = update_dist(ob,torch.from_numpy(support).float(),z,gamma=0.5)\n",
    "plt.bar(support,z)   "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<BarContainer object of 51 artists>"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAjUAAAGdCAYAAADqsoKGAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAA9hAAAPYQGoP6dpAAAuPElEQVR4nO3df3DTdZ7H8VdTtqkITSmFpmWrBWH5sUCLLY31VPTIGJTxrmd1C+JSuwysDqAQdaUOtKDutfLLLsLacU/Em5OFZUa5W2Q6g1H0PGLRVsYBhQFOrAIJINNGytBCm/vDMxrbAqmF0A/Px8x3bD55fz/f9zeZkJfffPNNTDAYDAoAAKCHs0S7AQAAgO5AqAEAAEYg1AAAACMQagAAgBEINQAAwAiEGgAAYARCDQAAMAKhBgAAGKFXtBu4XNra2nTkyBH17dtXMTEx0W4HAABchGAwqG+//VZpaWmyWM5/LOaqCTVHjhxRenp6tNsAAABd8NVXX+mXv/zleWuumlDTt29fSd89KAkJCVHuBgAAXIxAIKD09PTQ+/j5XDWh5vuPnBISEgg1AAD0MBdz6ggnCgMAACMQagAAgBEINQAAwAiEGgAAYARCDQAAMAKhBgAAGIFQAwAAjECoAQAARiDUAAAAIxBqAACAEQg1AADACIQaAABgBEINAAAwAqEGAAAYoVe0GwAAmC9jwVvdMs+hisndMg/MxJEaAABgBEINAAAwAqEGAAAYgVADAACMQKgBAABGINQAAAAjEGoAAIARCDUAAMAIXQo1a9asUUZGhuLj4+VwOLRz585Oa//yl7/o1ltvVb9+/dSvXz85nc529cFgUKWlpUpNTdU111wjp9Op/fv3h9WcPHlS06ZNU0JCghITEzVjxgydOnWqK+0DAAADRRxqNm7cKLfbrbKyMtXV1SkzM1Mul0vHjh3rsH779u2aOn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ujrs9rp16zRw4EDV1tbqtttuC4337t2702AEAACubhEdqWlpaVFtba2cTucPE1gscjqd8nq93dZUY2OjJCkpKSls/PXXX1dycrJGjx6tkpISnT59utM5mpubFQgEwhYAAGCuiI7UnDhxQq2trUpJSQkbT0lJ0d69e7uloba2Ns2bN0//8A//oNGjR4fGH3jgAV1//fVKS0vTp59+qqeeekr79u3TG2+80eE85eXlWrJkSbf0BAAArnwRf/x0qc2ePVu7d+/WBx98EDY+a9as0N9jxoxRamqqJk6cqIMHD+qGG25oN09JSYncbnfodiAQUHp6+qVrHAAARFVEoSY5OVmxsbHy+/1h436/v1vOdZkzZ462bNmi999/X7/85S/PW+twOCRJBw4c6DDUWK1WWa3Wn90TAADoGSI6pyYuLk7Z2dnyeDyhsba2Nnk8HuXl5XW5iWAwqDlz5ujNN9/UO++8o8GDB19wnV27dkmSUlNTu7xdAABgjog/fnK73SoqKlJOTo5yc3NVWVmppqam0Lehpk+frkGDBqm8vFzSdycXf/bZZ6G/Dx8+rF27dqlPnz4aOnSopO8+clq/fr3+8z//U3379pXP55Mk2Ww2XXPNNTp48KDWr1+vu+++W/3799enn36q+fPn67bbbtPYsWO75YEAAAA9W8ShprCwUMePH1dpaal8Pp+ysrJUXV0dOnm4vr5eFssPB4COHDmicePGhW4vX75cy5cv14QJE7R9+3ZJ0ksvvSTpuwvs/dirr76qhx56SHFxcXr77bdDASo9PV0FBQVauHBhpO0DAABDxQSDwWC0m7gcAoGAbDabGhsblZCQEO12AOCqkrHgrW6Z51DF5G6ZBz1HJO/f/PYTAAAwAqEGAAAYgVADAACMQKgBAABGINQAAAAjEGoAAIARCDUAAMAIhBoAAGAEQg0AADACoQYAABiBUAMAAIxAqAEAAEYg1AAAACMQagAAgBEINQAAwAiEGgAAYARCDQAAMAKhBgAAGIFQAwAAjECoAQAARiDUAAAAIxBqAACAEQg1AADACIQaAABgBEINAAAwAqEGAAAYgVADAACMQKgBAABGINQAAAAjEGoAAIARCDUAAMAIXQo1a9asUUZGh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UKP32t7/V0qVL5fP5tHDhQs2ePfuK/zXUq4HX61VNTY3uuOMO9e3bV16vV/Pnz9eDDz6ofv36Rbs96LuPB4uKipSTk6Pc3FxVVlaqqalJxcXF0W4NP/HEE0/onnvu0fXXX68jR46orKxMsbGxmjp1arRbw/87depU2JGzL774Qrt27VJSUpKuu+46zZs3T88995yGDRumwYMHa9GiRUpLSwv9T0XURfvrV6YrKioKSmq3vPvuu6GaQ4cOBe+6667gNddcE0xOTg4+/vjjwbNnz0avaYTU1tYGHQ5H0GazBePj44MjR44M/uu//mvwzJkz0W4NP/Liiy8Gr7vuumBcXFwwNzc3+OGHH0a7JXSgsLAwmJqaGoyLiwsOGjQoWFhYGDxw4EC028KPvPvuux2+ZxUVFQWDwe++1r1o0aJgSkpK0Gq1BidOnBjct29fdJv+kZhgMBiMVqACAADoLnz7CQAAGIFQAwAAjECoAQAARiDUAAAAIxBqAACAEQg1AADACIQaAABgBEINAAAwAqEGAAAYgVADAACMQKgBAABGINQAAAAj/B8VtBCQ/Edc0wAAAABJRU5ErkJggg==",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "ob_reward = [5,5,5,5,5,5,5,5,5]\n",
    "for ob in ob_reward:\n",
    "    z = update_dist(ob,torch.from_numpy(support).float(),z,gamma=0.5)\n",
    "plt.bar(support,z)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def dist_dqn(x,theta,aspace=3):\n",
    "    dim0,dim1,dim2,dim3 = 128,100,25,51\n",
    "    t1 = dim0*dim1 # 128*100 # \n",
    "    t2 = dim2*dim1 #25*100 \n",
    "    theta1 = theta[0:t1].reshape(dim0,dim1) #[128,100] \n",
    "    theta2 = theta[t1:t1+t2].reshape(dim1,dim2) #[25,100]\n",
    "    \n",
    "    l1 = x @ theta1  \n",
    "    l1 = torch.selu(l1)\n",
    "    \n",
    "    l2  = l1@theta2\n",
    "    l2 = torch.selu(l2)\n",
    "    \n",
    "    l3 = []\n",
    "    \n",
    "    for i in range(aspace):\n",
    "        step = dim2*dim3\n",
    "        \n",
    "        theta5_dim = t1+t2+i*step\n",
    "        theta5 = theta[theta5_dim:theta5_dim+step].reshape(dim2,dim3)\n",
    "        \n",
    "        l3_ = l2@theta5\n",
    "        l3.append(l3_)\n",
    "    l3 = torch.stack(l3,dim=1)\n",
    "    l3 = torch.nn.functional.softmax(l3,dim=2)\n",
    "    return l3.squeeze()\n",
    "    \n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_target_dist(dist_batch,action_batch,reward_batch,support,lim=(-10,10),gamma=0.8):\n",
    "    nsup = support.shape[0]\n",
    "    vmin,vmax = lim[0],lim[1]\n",
    "    \n",
    "    dz = (vmax-vmin)/(nsup-1)\n",
    "    target_dist_batch = dist_batch.clone()\n",
    "    for i in range(dist_batch.shape[0]):\n",
    "        dist_full = dist_batch[i]\n",
    "        action = int(action_batch[i].item())\n",
    "        dist = dist_full[action] #　\n",
    "        r = reward_batch[i]\n",
    "        if r!= -1:\n",
    "            target_dist = torch.zeros(nsup)\n",
    "            bj = np.round((r-vmin)/dz)\n",
    "            bj = int(np.clip(bj,0,nsup-1))\n",
    "            target_dist[bj] = 1\n",
    "        else:\n",
    "            target_dist = update_dist(r,support,dist,lim=lim,gamma=gamma)\n",
    "            \n",
    "        target_dist_batch[i,action,:] = target_dist\n",
    "        \n",
    "    return target_dist_batch"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def lossfn(x,y):\n",
    "    loss = torch.tensor([0])\n",
    "    loss.require_grad =  True\n",
    "    for i in range(x.shape[0]):\n",
    "        loss_ = -1*torch.log(x[i].flatten(start_dim = 0))@y[i].flatten(start_dim =0)\n",
    "        loss = loss_ +loss\n",
    "        \n",
    "    return loss"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "procthor-rl",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.20"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
